package com.xjoyt.pay.gateway.po;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

/**
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_token_log")
public class TokenLog {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "token_log_id", length = 36)
	public String id;

	/**
	 * 状态
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "is_success")
	public Boolean success;

	/**
	 * 录入日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

	/**
	 * 访问令牌
	 */
	@Column(name = "access_token", length = 255)
	public String accessToken;

	/**
	 * 公司id
	 */
	@Column(name = "company_id", length = 36)
	public String companyId;

	/**
	 * 公司
	 */
	@Column(name = "company_name", length = 50)
	public String companyName;

	/**
	 * 商户id
	 */
	@Column(name = "merchant_id", length = 36)
	public String merchantId;

	/**
	 * 商户名称
	 */
	@Column(name = "merchant_name", length = 50)
	public String merchantName;

	/**
	 * 商户号
	 */
	@Column(name = "merchant_no", length = 50)
	public String merchantNo;

	/**
	 * 代理商id
	 */
	@Column(name = "distributor_id", length = 36)
	public String distributorId;

	/**
	 * 代理商名
	 */
	@Column(name = "distributor_name", length = 50)
	public String distributorName;

	/**
	 * 代理商号
	 */
	@Column(name = "distributor_no", length = 50)
	public String distributorNo;

	/**
	 * 令牌
	 */
	@Column(name = "token", length = 255)
	public String token;

	/**
	 * 签名
	 */
	@Column(name = "sign", length = 255)
	public String sign;

	/**
	 * 随机字符串
	 */
	@Column(name = "nonce", length = 255)
	public String nonce;

	/**
	 * 时间戳
	 */
	@Column(name = "`timestamp`")
	public Long timestamp;

	/**
	 * 错误信息
	 */
	@Column(name = "error_message", length = 255)
	public String errorMessage;

	/**
	 * 异常
	 */
	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "exception", columnDefinition = "TEXT")
	public String exception;
}
